home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / pibt40s6.arc / SETINPTK.MOD < prev    next >
Text File  |  1986-06-12  |  4KB  |  84 lines

  1. (*----------------------------------------------------------------------*)
  2. (*                Set_Input_Keys --- Set Input Key Values               *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. PROCEDURE Set_Input_Keys( File_Name : AnyStr );
  6.  
  7. (*----------------------------------------------------------------------*)
  8. (*                                                                      *)
  9. (*     Procedure:  Set_Input_Keys                                       *)
  10. (*                                                                      *)
  11. (*     Purpose:    Set values of function keys and keypad keys          *)
  12. (*                                                                      *)
  13. (*     Calling Sequence:                                                *)
  14. (*                                                                      *)
  15. (*        Set_Input_Keys( File_Name : AnyStr );                         *)
  16. (*                                                                      *)
  17. (*           If not null is file name to read key definitions from.     *)
  18. (*                                                                      *)
  19. (*     Calls:                                                           *)
  20. (*               Menu_Display_Choices                                   *)
  21. (*               Menu_Get_Choices                                       *)
  22. (*               Read_Key_Defs_From_File;                               *)
  23. (*               Get_Key_Defs_From_Keyboard;                            *)
  24. (*               Write_Key_Defs_To_File;                                *)
  25. (*                                                                      *)
  26. (*     Remarks:                                                         *)
  27. (*                                                                      *)
  28. (*        This whole section of code should be reworked to use          *)
  29. (*        full-screen editing at some point.                            *)
  30. (*                                                                      *)
  31. (*----------------------------------------------------------------------*)
  32.  
  33. CONST
  34.    Quit_Item = 5;
  35.  
  36. VAR
  37.    Input_Key_Menu      : Menu_Type;
  38.    Done                : BOOLEAN;
  39.    Key_Type            : INTEGER;
  40.  
  41. BEGIN (* Set_Input_Keys *)
  42.                                    (* If file name specified, get keys *)
  43.                                    (* from specified file.             *)
  44.  
  45.    IF LENGTH( File_Name ) > 0 THEN
  46.       BEGIN
  47.          Read_Key_Defs_From_File( File_Name );
  48.          EXIT;
  49.       END;
  50.  
  51.    Make_A_Menu( Input_Key_Menu, Quit_Item, 11, 15, 0, 0, Quit_Item,
  52.                 'Function key definition: ',
  53.                 'D)isplay current definitions;E)nter definitions from keyboard;' +
  54.                 'R)ead definitions from file;' +
  55.                 'W)rite definitions to file;Q)uit key definition;',
  56.                 FALSE );
  57.  
  58.                                    (* Loop until quit chosen *)
  59.    Done := FALSE;
  60.  
  61.    REPEAT
  62.                                    (* Display menu of choices *)
  63.  
  64.       Menu_Display_Choices( Input_Key_Menu );
  65.       Key_Type := Menu_Get_Choice( Input_Key_Menu , Erase_Menu );
  66.  
  67.                                    (* Do requested operation *)
  68.       CASE Key_Type OF
  69.  
  70.          1: Display_Current_Key_Defs;
  71.          2: Get_Key_Defs_From_Keyboard;
  72.          3: Read_Key_Defs_From_File( File_Name );
  73.          4: Write_Key_Defs_To_File;
  74.          ELSE
  75.             Done := TRUE;
  76.  
  77.       END (* CASE *);
  78.  
  79.       Input_Key_Menu.Menu_Default := Quit_Item;
  80.  
  81.    UNTIL Done;
  82.  
  83. END   (* Set_Input_Keys *);
  84.